#ifndef SMOOTHIC_H
#define SMOOTHIC_H

#include "IndexCalculator.h"

template <typename T = double>
class SmoothIC : public IndexCalculator<T, T>
{
public:
    SmoothIC() : IndexCalculator<T, T>(2) {}

    void calculate(const T &new_data) override
    {
        if (this->data_count < 3)
        {
            this->result = new_data;
            return;
        }
        if (this->data[0] == this->data[1])
        {
            this->result = this->data[0];
        }
        else
        {
            this->result = new_data;
        }
    }
};

#endif // SMOOTHIC_H